Don't document build dependencies
authorAlex Crichton <alex@alexcrichton.com>
Sat, 5 Sep 2015 00:30:59 +0000 (17:30 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 8 Sep 2015 20:45:32 +0000 (13:45 -0700)
They're not actually relevant to the documentation, so omit them.

src/cargo/ops/cargo_rustc/context.rs
tests/test_cargo_doc.rs

index 5cfe983593ddc9fdc7eb00f83ed0ab948f1a8f0c..93ef0357cd3283f0d8ddb3da906295813a6b1a3c 100644 (file)
@@ -8,6 +8,7 @@ use regex::Regex;
 
 use core::{SourceMap, Package, PackageId, PackageSet, Resolve, Target, Profile};
 use core::{TargetKind, LibKind, Profiles, Metadata, Dependency};
+use core::dependency::Kind as DepKind;
 use util::{self, CargoResult, ChainError, internal, Config, profile};
 use util::human;
 
@@ -420,7 +421,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             pkg.dependencies().iter().filter(|d| {
                 d.name() == dep.name()
             }).any(|dep| {
-                dep.is_transitive() && self.dep_platform_activated(dep, kind)
+                match dep.kind() {
+                    DepKind::Normal => self.dep_platform_activated(dep, kind),
+                    _ => false,
+                }
             })
         }).filter_map(|dep| {
             dep.targets().iter().find(|t| t.is_lib()).map(|t| (dep, t))
index 42c7a95064124b693be8cd2339099d6c09c8c60b..6def20ba21d4ffbe2d7f4331dae0ba7f20775564 100644 (file)
@@ -348,6 +348,37 @@ test!(target_specific_documented {
                 execs().with_status(0));
 });
 
+test!(no_document_build_deps {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [package]
+            name = "foo"
+            version = "0.0.1"
+            authors = []
+
+            [build-dependencies]
+            a = { path = "a" }
+        "#)
+        .file("src/lib.rs", "
+            pub fn foo() {}
+        ")
+        .file("a/Cargo.toml", r#"
+            [package]
+            name = "a"
+            version = "0.0.1"
+            authors = []
+        "#)
+        .file("a/src/lib.rs", "
+            /// ```
+            /// ☃
+            /// ```
+            pub fn foo() {}
+        ");
+
+    assert_that(p.cargo_process("doc"),
+                execs().with_status(0));
+});
+
 test!(doc_release {
     let p = project("foo")
         .file("Cargo.toml", r#"